import React, {Component} from 'react'
import '../sass/Activity.scss'

export default class Activity extends Component {
  constructor() {
    super()
  }

  render() {
    let {items, chooseActivity, hideActivity} = this.props

    return (
            <div className="activity-select">
                <div className="activity-select-layout" onClick={hideActivity.bind(this)}></div>
                <div className="activity-select-box">
                    {
                        items.activity.map((item, index) =>
                            <div className="activity-select-box-item" key={index} onClick={chooseActivity.bind(this, {type: 1, goodsId: items.goodsId, activityId: item.activityId})}>
                                <span>{item.type === 2 ? '满赠' : item.type === 3 ? '加价购' : null}</span>
                                {item.name}
                                {item.selected && <i className="iconfont icon-shangpinxuankuang-xuanqu"/>}
                            </div>
                        )
                    }
                    <div className="activity-select-box-item" onClick={chooseActivity.bind(this, {type: 1, goodsId: items.goodsId, activityId: 'none'})}>
                        不参与活动
                    </div>
                </div>
            </div>
    )
  }
}
